package pqt;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.SwingConstants;
import java.awt.Toolkit;

public class Dialogo extends JDialog {

	private final JPanel contentPanel = new JPanel();
	JLabel texto = new JLabel("");
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			Dialogo dialog = new Dialogo("PASA");
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public Dialogo(String _texto) {
		
		setModal(true);
		setIconImage(Toolkit.getDefaultToolkit().getImage(Dialogo.class.getResource("/img/icono.png")));
		setTitle("MENSAJE");
		setBounds(100, 100, 417, 192);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		texto.setHorizontalAlignment(SwingConstants.CENTER);
		
		
		texto.setBounds(10, 25, 381, 102);
		texto.setFont(new Font("Tahoma", Font.PLAIN, 40));
		texto.setText("<html><p align='center'>"+ _texto +"</p></html>");
		contentPanel.add(texto);
		
		JButton btnNewButton = new JButton("New button");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			dispose();
			}
		});
		btnNewButton.setBounds(153, 101, 89, 23);
		contentPanel.add(btnNewButton);
		setVisible(true);
	}
}
